<script setup lang="ts">
import { ref, watch } from 'vue'
import { type DeviceTypeQuery, type DeviceTypeResp, listDeviceType } from '@/apis/vending/deviceType'

const deviceTypeList = ref<DeviceTypeResp[]>([])

watch(
  async () => {
    const query: DeviceTypeQuery = {
      name: '',
      status: '1',
      sort: ['createTime,desc'],
    }
    const { data } = await listDeviceType(query)
    deviceTypeList.value = data
  },
  { immediate: true },
)
</script>

<template>
  <a-select
    allow-clear style="width: 150px"
    placeholder="请选择机型"
  >
    <a-option
      v-for="item in deviceTypeList"
      :key="item!.name"
      :value="item!.id"
      :label="item!.name"
    >
    </a-option>
  </a-select>
</template>

<style scoped lang="less"></style>
